ndk_path="/home/cqchu/local/android-ndk-r18b"
dst_path="/data/local/tmp/ccq/cltest/"
build_path="build"
exe_file="bin/main"
cl_file="src/kernels/*.cl"
lib_file="lib/*.so"

# cmake编译过程
if [ ! -d ${build_path} ]; then
  mkdir ${build_path}
fi
cd ${build_path}
cmake -DCMAKE_TOOLCHAIN_FILE=${ndk_path}/build/cmake/android.toolchain.cmake \
      -DANDROID_ABI="arm64-v8a" \
      -DANDROID_NATIVE_API_LEVEL=android-23 \
      ..
make
cd ..

# 传到手机上并执行
# adb push ${lib_file} ${dst_path}
adb push ${exe_file} ${dst_path}
# adb push ${lib_file} ${dst_path}
adb push ${cl_file} ${dst_path}
echo "cd ${dst_path} && ./main" | adb shell